#include<iostream>
using namespace std;

struct ListNode {
 int val;
 ListNode *next;
 ListNode() : val(0), next(nullptr) {}
 ListNode(int x) : val(x), next(nullptr) {}
 ListNode(int x, ListNode *next) : val(x), next(next) {}
};

class Solution {
public:
    ListNode* oddEvenList(ListNode* head) {
        ListNode *odd = new ListNode(), *even = new ListNode(), *mov = head;
        ListNode *mov_o = odd, *mov_e = even;
        while(mov){
        	mov_o->next = mov;
        	mov = mov->next;
        	mov_o->next->next = nullptr;
        	mov_o = mov_o->next;
        	if(!mov)break;
        	mov_e->next = mov;
        	mov = mov->next;
        	mov_e->next->next = nullptr;
        	mov_e = mov_e->next;
		}
		mov_o->next = even->next;
		return odd->next;
    }
};

int main(){
	return 0;
} 
